@extends('layouts.master')
@section('content')
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox">
                <div class="ibox-content">
                    <form class="layui-form" action="">
                        <div class="layui-inline">
                            <label class="layui-form-label">订单号:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="query[order_id]" lay-verify="" placeholder="订单号搜索"
                                       value="{{$query['order_id']}}" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">订单状态</label>
                            <div class="layui-input-inline">
                                <select name="query[status]" lay-verify="">
                                    <option value="">全部</option>
                                    <option value="1">待接单</option>
                                    <option value="2">配送中</option>
                                    <option value="3">完成</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">学校</label>
                            <div class="layui-input-inline">
                                <input type="text" name="query[school_name]" lay-verify="" placeholder="学校搜索"
                                       value="{{$query['school_name']}}" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">时间类型</label>
                            <div class="layui-input-inline">
                                <select name="query[time_type]" lay-verify="">
                                    <option value="">全部</option>
                                    @foreach($queryData['time_types'] as $index=>$item)
                                        <option value="{{$index}}" {{ $query['time_type']==$index ? 'selected': ''}}>{{$item}}</option>
                                    @endforeach
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">时间:</label>
                            <div class="layui-input-inline" style="width: 150px;">
                                <input type="text" class="layui-input  start_time" value="{{$query['start_time']}}"
                                       name="query[start_time]"
                                       readonly>
                            </div>
                            -
                            <div class="layui-input-inline" style="width: 150px;">
                                <input type="text" class="layui-input end_time" value="{{$query['end_time']}}"
                                       name="query[end_time]"
                                       readonly>
                            </div>
                        </div>
                        <div class="layui-inline" style="padding-bottom: 5px">
                            <div class="layui-input-inline">
                                <input type="hidden" name="page_num" value="{{$currentPageNum}}">
                                <button name="submit" class="btn btn-success" type="submit">搜索</button>
                            </div>
                        </div>
                    </form>
                    @include('common.toolbar', ['pager' => $pager])
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th>订单号</th>
                            <th>发件</th>
                            <th>收件</th>
                            <th>站点</th>
                            <th>配送员</th>
                            <th>实际支付</th>
                            <th>订单状态</th>
                            <th>下单时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($pager as $item)
                            <tr class="tr_checkbox_switch">
                                <td>
                                    {{$item->order_id}}
                                </td>
                                <td>
                                    <div style="display: flex;flex-direction: column">
                                        <div>地址：{{$item->from_address}}</div>
                                        <div>姓名：{{$item->from_name}}</div>
                                        <div>手机号：{{$item->from_phone}}</div>
                                    </div>
                                </td>
                                <td>
                                    {{$item->to_address}}<br/>
                                    @if($item->to_pic)
                                        <img src="{{$item->to_pic}}" class="img_pop_show rounded img-sm"/><br/>
                                    @endif
                                </td>
                                {{$item->school->name}}
                                <td>
                                    {{$item->escort->realname}}<br/>
                                    {{$item->escort->phone}}
                                </td>
                                <td>
                                    ￥{{$item->pay_price}}
                                </td>
                                <td>
                                    {{$item->status_text}}
                                </td>
                                <td>
                                    {{$item->add_time}}
                                </td>

                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                    @include('common.pagination', ['pager' => $pager])
                </div>
            </div>
        </div>
    </div>
@endsection
@section('script')
    <script>
        layui.use(['laydate', 'element'], function () {
            var laydate = layui.laydate, element = layui.element;
            //日期时间选择器
            laydate.render({
                elem: '.start_time'
                , type: 'datetime'
            });
            laydate.render({
                elem: '.end_time'
                , type: 'datetime'
            });
        });
    </script>
@endsection